package manage.dao;

import m.common.dao.Dao;
import m.system.db.DBManager;
import m.system.db.DataRow;
import m.system.db.DataSet;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

public class GroupMenuLinkDao extends Dao {
	public Map<String,Object> getGroupMenuLink(String group_oid) throws SQLException{
		Map<String,Object> map= new HashMap<>();
		DataSet ds=DBManager.executeQuery("SELECT menu_oid,oid FROM os_group_menu_link where admin_group_oid=?", new String[]{group_oid});
		for(DataRow dr : ds.rows()){
			map.put(dr.get(String.class,"menu_oid"), dr.get(String.class,"oid"));
		}
		return map;
	}
	public void removeAllGroupMenuLink(String admin_group_oid) throws SQLException{
		DBManager.executeUpdate("delete from os_group_menu_link where admin_group_oid=?",admin_group_oid);
	}
}
